FROM node:12.18.2-alpine3.12

RUN echo https://mirrors.ustc.edu.cn/alpine/v3.12/main > /etc/apk/repositories &&\
    echo https://mirrors.ustc.edu.cn/alpine/v3.12/community >> /etc/apk/repositories
RUN apk --no-cache add python2 build-base
RUN npm config set registry https://registry.npm.taobao.org
RUN npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
RUN npm config set phantomjs_cdnurl=https://npm.taobao.org/mirrors/phantomjs/
RUN npm config set electron_mirror=https://npm.taobao.org/mirrors/electron/
RUN npm config set registry=https://registry.npm.taobao.org


WORKDIR /app

COPY . .

RUN npm install && npm run build:prod


FROM nginx:1.19.2-alpine

COPY --from=build-stage /app/dist/heal /usr/share/nginx/heal
COPY --from=build-stage /app/nginx/nginx.conf /etc/nginx/conf.d/default.conf

EXPOSE 8080
